package org.jsbd.boss.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.jsbd.boss.common.DataGridModel;
import org.jsbd.boss.dao.IMiguVideoConfigDao;
import org.jsbd.boss.domian.MiguMusicConfigBean;
import org.jsbd.boss.domian.MiguVideoConfigBean;
import org.jsbd.boss.domian.MiguVideoProvinceConfig;
import org.springframework.stereotype.Repository;

@Repository("miguVideoConfigDao")
public class MiguVideoConfigDaoImpl extends CrackBaseDao implements IMiguVideoConfigDao {

	@Override
	public Map<String, Object> getMiguMusicConfigListPage(DataGridModel page, MiguVideoConfigBean form) {
		form = (form == null ? new MiguVideoConfigBean() : form);
		form.setPageInfo(page);
		Map<String, Object> results = new HashMap<String, Object>();
		results.put("rows", super.queryForList("qy_migu_video_config.select_migu_video_config_list", form));
		results.put("total", super.queryForCount("qy_migu_video_config.select_migu_video_config_page_count", form));
		return results;
	}

	@Override
	public MiguVideoConfigBean selectMiguVideoConfig(MiguVideoConfigBean miguVideoConfig) {
		return (MiguVideoConfigBean) super.queryForObject("qy_migu_video_config.SELECT_MIGU_VIDEO_CONFIG", miguVideoConfig);
	}

	@Override
	public void insert(MiguVideoConfigBean miguVideoConfig) {
		super.insert("qy_migu_video_config.INSERT", miguVideoConfig);
	}

	@Override
	public void update(MiguVideoConfigBean miguVideoConfig) {
		super.update("qy_migu_video_config.UPDATE", miguVideoConfig);
	}

	@Override
	public void delete(MiguVideoConfigBean miguVideoConfig) {
		super.update("qy_migu_video_config.DELETE", miguVideoConfig);
	}

	@Override
	public void updateMiguVideoStatus(MiguVideoConfigBean miguVideoConfig) {
		super.update("qy_migu_video_config.UPDATE_MIGU_VIDEO_STATUS", miguVideoConfig);
	}

	@Override
	public MiguVideoConfigBean selectMiguVideoConfigAll(MiguVideoConfigBean queryMvc) {
		return (MiguVideoConfigBean) super.queryForObject("qy_migu_video_config.SELECT_MIGU_VIDEO_CONFIG_ALL", queryMvc);
	}

	@Override
	public MiguVideoConfigBean selectMiguVideoConfigExName(String name, Integer id) {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("name", name);
		params.put("id", id);
		return (MiguVideoConfigBean) super.queryForObject("qy_migu_video_config.SELECT_MIGU_VIDEO_CONFIG_EX_NAME", params);
	}

	@Override
	public MiguVideoConfigBean selectMiguVideoConfigByName(MiguVideoConfigBean queryMvc) {
		return (MiguVideoConfigBean) super.queryForObject("qy_migu_video_config.SELECT_MIGU_VIDEO_CONFIG_BY_NAME", queryMvc);
	}

	@Override
	public MiguVideoConfigBean selectMiguVideoConfigByChannelId(String channelId) {
		return (MiguVideoConfigBean) super.queryForObject("qy_migu_video_config.SELECT_MIGU_VIDEO_CONFIG_BY_CHANNEL_ID", channelId);
	}
	
	@Override
	public MiguVideoConfigBean getByName(String name) {
		return (MiguVideoConfigBean) super.queryForObject("qy_migu_video_config.select_by_name", name);
	}

	@Override
	public void updateDaylimit(List<MiguVideoConfigBean> configs) {
		super.batchUpdate("qy_migu_video_config.UPDATE_DAY_LIMIT", configs);
	}

	@Override
	public List<MiguVideoProvinceConfig> selectProvinceById(Integer id) {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", id);
		return super.queryForList("qy_migu_video_config.SELECT_PROVINCE_BY_ID", params);
	}

	@Override
	public void batchInsertProvinceConfig(List<MiguVideoProvinceConfig> mvpcs) {
		super.batchInsert("qy_migu_video_config.BATCH_INSERT_PROVINCE_CONFIG", mvpcs);
	}

	@Override
	public void deleteProvinceConfigs(MiguVideoProvinceConfig mvpc) {
		super.delete("qy_migu_video_config.DELETE_PROVINCE_CONFIGS", mvpc);
	}

	@Override
	public List<MiguVideoConfigBean> getMiguVideoConfigList(MiguVideoConfigBean bean) {
		return super.queryForList("qy_migu_video_config.select_migu_video_config_list", bean);
	}

}
